﻿Imports System
Imports System.Windows.Forms

Namespace System.Workflow.ComponentModel.Design
    Public Class CompositeDesignerAccessibleObject
        Inherits ActivityDesignerAccessibleObject
        ' Methods
        Public Sub New(ByVal activityDesigner As CompositeActivityDesigner)
            MyBase.New(activityDesigner)
        End Sub

        Public Overrides Function GetChild(ByVal index As Integer) As AccessibleObject
            Dim activityDesigner As CompositeActivityDesigner = [TryCast](MyBase.ActivityDesigner,CompositeActivityDesigner)
            If ((index >= 0) AndAlso (index < activityDesigner.ContainedDesigners.Count)) Then
                Return activityDesigner.ContainedDesigners.Item(index).AccessibilityObject
            End If
            Return MyBase.GetChild(index)
        End Function

        Public Overrides Function GetChildCount() As Integer
            Dim activityDesigner As CompositeActivityDesigner = [TryCast](MyBase.ActivityDesigner,CompositeActivityDesigner)
            Return activityDesigner.ContainedDesigners.Count
        End Function


        ' Properties
        Public Overrides ReadOnly Property State As AccessibleStates
            Get
                Dim state As AccessibleStates = MyBase.State
                Dim activityDesigner As CompositeActivityDesigner = [TryCast](MyBase.ActivityDesigner,CompositeActivityDesigner)
                Return (state Or If(activityDesigner.Expanded, &H200, &H400))
            End Get
        End Property

    End Class
End Namespace

